/**
 * Form used for search Consolidations
 */
Ext.define('Sisconsolid.view.consolidation.search.Form', {
    extend: 'Ext.form.Panel',
    alias: 'widget.consolidation.search.form',
    requires: [
        'Ext.form.FieldSet',
		'Ext.form.FieldContainer',
        'Ext.form.field.Date',
        'Ext.form.field.Text',
		'Ext.form.RadioGroup',
		'Ext.form.field.Radio',
		'Sisconsolid.store.util.ConsolidatorList',
		'Sisconsolid.store.Families',
    ],
    bodyPadding: 5,
    initComponent: function() {
        var me = this;
        Ext.applyIf(me, {
            fieldDefaults: {
                allowBlank: true,
                labelAlign: 'top',
                flex: 1,
                margins: 5
            },
            defaults: {
                layout: 'hbox',
                margins: '0 10 0 10'                
            },
            items: [
                {
                    xtype: 'fieldset',
					title: translations.consolidationFilters,
					items: [
                        {
							xtype: 'fieldcontainer',
							layout: 'anchor',
							items: [
								{
									xtype: 'datefield',
									name: 'fromDate',
									fieldLabel: translations.dateFrom,
									submitFormat: 'Y-m-d',
									anchor: '60%'
								},
								{
									xtype: 'datefield',
									name: 'toDate',
									fieldLabel: translations.dateTo,
									submitFormat: 'Y-m-d',
									anchor: '60%'									
								},
								{
									xtype: 'textfield',
									name: 'firstName',
									fieldLabel: translations.firstName
								},
								{
									xtype: 'textfield',
									name: 'lastName',
									fieldLabel: translations.lastName
								}
							]
						},
						{
							xtype: 'fieldcontainer',
							items: [
								{
									xtype: 'combobox',
									name: 'family',
									fieldLabel: translations.family,
									store: {
										type: 'family'
									},
									valueField: 'key',									
									displayField: 'value',
									editable: false
								},
								{
									xtype: 'combobox',
									name: 'tookData',
									fieldLabel: translations.tookData,
									store: {
										type: 'util.consolidatorList'
									},
									valueField: 'key',									
									displayField: 'value',
									editable: false
								},
								{
									xtype: 'combobox',
									name: 'assignedTo',
									fieldLabel: translations.assignedTo,
									store: {
										type: 'util.consolidatorList'
									},
									valueField: 'key',									
									displayField: 'value',
									editable: false
								},
								{
									xtype: 'radiogroup',									
									name: 'attendedCell',
									fieldLabel: translations.integratedToCell,			
									items: [
										{boxLabel: translations.yes, name: 'attendedCell', inputValue: true},
										{boxLabel: translations.no, name: 'attendedCell', inputValue: false}
									]
								}
							]
						}
                    ]
                }
            ]
        });
        me.callParent( arguments );
    }
});